/* 
	$("#demo").attr("style","display:none;");//隐藏div
	$("#demo").attr("style","display:block;");//显示div
*/
$(function(){
	var username = $.cookie("name");
	if( username != null ){
		$("#login-username").html("账户名："+username);
	}
	var permissions = null;
	permissions = $.cookie("permissionsId");
	console.log("权限："+permissions);
	
	if( permissions == null ){
		$("#login_permissions").html("<i class='fa fa-bars' aria-hidden='true'></i>");
	}else if( permissions == 1 ){
		$("#login_permissions").html("录入");
	}else if( permissions == 2 ){
		$("#login_permissions").html("派出所");
	}else if( permissions == 3 ){
		$("#login_permissions").html("分局");
	}else if( permissions == 4 ){
		$("#login_permissions").html("市局");
	}
	
	/*$("#Front_end_review")	//前端信息审核
	$("#Registration_of_floating_population")	//流动人口登记
	$("#The_back-end_audit")	//后端信息审核
	$("#Back-end_registration_audit")	//后端注册信息审核
	$("#Audit_of_back-end_floating_population")	//后端流动人口信息审核
	$("#Management_of_floating_population")	//后端流动人口管理
*/	

	if( permissions == null ){
		$("#The_back-end_audit").attr("style","display:none;");
		$("#Back-end_registration_audit").attr("style","display:none;");
		$("#Management_of_floating_population").attr("style","display:none;");
		$("#Front_end_review").attr("style","display:none;");
		$("#Registration_of_floating_population").attr("style","display:none;");
	}else if( permissions == 1 ){
		$("#The_back-end_audit").attr("style","display:none;");
		$("#Back-end_registration_audit").attr("style","display:none;");
		$("#Management_of_floating_population").attr("style","display:none;");
	}else if( permissions == 2 ){
		$("#Front_end_review").attr("style","display:none;");
		$("#Registration_of_floating_population").attr("style","display:none;");
	}else if( permissions == 3 ){
		$("#Front_end_review").attr("style","display:none;");
		$("#Registration_of_floating_population").attr("style","display:none;");
		$("#Audit_of_back-end_floating_population").attr("style","display:none;");
	}else if( permissions == 4 ){
		$("#Front_end_review").attr("style","display:none;");
		$("#Registration_of_floating_population").attr("style","display:none;");
		$("#Audit_of_back-end_floating_population").attr("style","display:none;");
	}
	
	//退出功能
	$("#btn-exit").click(function(){
		$.ajax({
			"url" : "/index/exit", 
			"type" : "post",
			"dataType" : "json",
			"success" : function(json) {
				window.location.href="login.html"
			}
		});
	})
	
}); 